<?php
class Rooms_model extends CI_Model
{
	public function __construct()
	{
		$this->load->database();
	}	
	
	public function get_rooms($name = FALSE)
	{
		if ($name === FALSE)
		{
			$query = $this->db->get('rooms');
			return $query->result_array();
		}
		$query = $this->db->get_where('rooms', array('name' => $name));
		return $query->row_array();
	}	
	
	public function set_rooms()
	{
		$data = array(
			'name' => $this->input->post('name'),
			'capacity' => $this->input->post('capacity'),
			'special' => $this->input->post('special')
		);
		
		return $this->db->insert('rooms', $data);
	}	
}